package com.crm.mapper;

import com.crm.aonnation.AutoFill;
import com.crm.dto.ClueQueryPagePramDto;
import com.crm.dto.GainDto;
import com.crm.dto.IsFalseDto;
import com.crm.enumeration.OperationType;
import com.crm.pojo.BusinessRecord;
import com.crm.pojo.Clue;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ClueMapper {
    /**
     * 分页查询线索信息
     *
     * @param dto
     * @return
     */
    List<Clue> queryPageClue(ClueQueryPagePramDto dto);

    /**
     * 新增线索
     *
     * @param clue
     */
    @AutoFill(value = OperationType.INSERT)
    void addClue(Clue clue);

    /**
     * 根据线索id查询线索信息
     *
     * @param id
     * @return
     */
    Clue queryById(Long id);

    /**
     * 分页查询线索池
     *
     * @param dto
     * @return
     */
    List<Clue> queryPagePool(ClueQueryPagePramDto dto);

    @Select("select * from communication_records where clue_id=#{clueId}")
    List<BusinessRecord> queryRecord(Long clueId);

    void gainClue(GainDto gain);

    void isFalse(@Param("id") Long id, @Param("dto") IsFalseDto dto);


}
